<?php
namespace app\model;
use app\BaseModel;
use app\model\LeasingCompany;
use think\model\concern\SoftDelete;


class Unifiedorder extends BaseModel
{

    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = '0000-00-00 00:00:00';
    protected $hidden = ['update_time','delete_time','sort','status'];

    // 定义全局的查询范围
    protected $globalScope = ['status'];

    public function scopeStatus($query)
    {
        $query->where('status',2);
    }

    public function searchMemberIdAttr($query,$value,$data){
        if(!empty($value)){
            $query->where('member_id','=',$value);
        }
    }



    protected function setMemberIdAttr($value,$data){ //当前字段的修改器
         $this->set('member_mobile',LeasingCompany::where('id',$value)->value('title'));

         return $value;
    }





}